"use strict";
//买卖股票的最佳时机
function stockFun(arr) {
    let sum = 0;
    for (let i = 1; i < arr.length; i++) {
        let num = arr[i + 1] - arr[i];
        if (num > 0) {
            sum += num;
        }
    }
    return sum;
}
console.log(stockFun([6, 1, 5, 3, 6, 4]));
